package com.liyang.shutdowhook;

import java.util.concurrent.TimeUnit;

/**
 * -Xmx20M
 */
public class HookTest2
{
	public void start()
	{
		Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
			@Override
			public void run()
			{
				System.out.println("Execute Hook.....");
			}
		}));
	}
	
	public static void main(String[] args)
	{
		new HookTest().start();
		System.out.println("The Application is doing something");
		byte[] b = new byte[500*1024*1024];
		try
		{
			TimeUnit.MILLISECONDS.sleep(5000);
		}
		catch (InterruptedException e)
		{
			e.printStackTrace();
		}
	}
 
}